﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>JS山寨桌面窗口OOP版</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="../css/createWindowsOOP.css" />
<script type="text/javascript" charset="utf-8" src="../js/createWindowsOOP.js"></script>
<script type="text/javascript" charset="utf-8" src="../js/clock.js"></script>
<script type="text/javascript">
window.onload = function() {
	createWindow();
	var myClock = new Clock();
	var clockContainer = $("systemTime");
	clockContainer.innerHTML = clockContainer.innerText = myClock.toString();
}
function createWindow() {
	var windowID = 0;
	var createButton = $("createWindowButton");
	var maxWindowNum = getMaxWindowNum();
	createButton.onclick = function() {
		if(myGetElementsByClassName(true, "window", "div", "body").length<maxWindowNum) {
			var mywindow = new Window(windowID, 250, 150);
			//初始化并激活方法
			mywindow.initialize();
			windowID += 1;
		}
	}
}
function getMaxWindowNum() {
	return (document.body.clientWidth - $("systemTime").offsetWidth - $("menu").offsetWidth) / 120;
}
</script>
</head>
<body>
<div id="windowsList">
	<div id="menu"><button id="createWindowButton">创建窗口</button></div>
	<div id="systemTime">systemTime</div>
</div>

</body>
</html>


